<?php

namespace ding;

class MiniPro
{
    private $appid = '';
    private $appsecret = '';


    public function __construct()
    {
        // 获取配置
        $config = config('minipro');

        $this->appid = $config['appid'];
        $this->appsecret = $config['appsecret'];
    }

    // 通过code获取openid
    public function getOpenid($code)
    {
        $url = 'https://api.weixin.qq.com/sns/jscode2session?appid=' . $this->appid . '&secret=' . $this->appsecret . '&js_code=' . $code . '&grant_type=authorization_code';
        $res = $this->httpRequest($url);
    }
}